import { useRef } from 'react';

import { Comments } from './Comments-04-生命周期';

export const App = () => {
  // 获取原生
  const inputRef = useRef(null);
  // 获取自定义组件
  const commentRef = useRef(null);

  return (
    <div>
      <input type={'text'} ref={inputRef}></input>
      <button
        onClick={() => {
          console.log(commentRef.current);
          commentRef.current.addComment('wahaha');
        }}
      >
        按钮
      </button>
      <Comments ref={commentRef} />
    </div>
  );
};
